//
//  ItemDBO.h
//  POS
//
//  Created by sigma xu on 4/29/13.
//  Copyright (c) 2013 sigma xu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "AppDelegate.h"

@interface ItemDBO : NSObject{
    NSString *so_id;
    NSString *item_barcode;
    NSString *item_name;
    NSString *item_brand;
    NSString *item_package;
    NSString *quantity;
    NSString *unit;
    NSString *unit_price;
    NSString *create_date;
    
    sqlite3 *posDB;
    NSString *databasePath;
    sqlite3_stmt * sqlstmt1;
    sqlite3_stmt * sqlstmt2;
    sqlite3_stmt * updatestmt;
    sqlite3_stmt * checkstmt;
    
    NSMutableArray *item_list;
    
}
@property (nonatomic, readwrite) NSString *so_id;
@property (nonatomic, readwrite) NSString *item_barcode;
@property (nonatomic, readwrite) NSString *item_name;
@property (nonatomic, readwrite) NSString *item_brand;
@property (nonatomic, readwrite) NSString *item_package;
@property (nonatomic, readwrite) NSString *quantity;
@property (nonatomic, readwrite) NSString *unit;
@property (nonatomic, readwrite) NSString *unit_price;
@property (nonatomic, readwrite) NSString *remark;
@property (nonatomic, readwrite) NSString *create_date;

-(NSMutableArray *) load_item_list_from_so:(NSString *) id_so;
-(void) insert_sales_order_each_item;
-(void) delete_sales_order_each_item;
-(void) check_update_so_item;
-(ItemDBO *) get_item_by_barcode:(NSString *) barcode unit_code:(NSString *) unit_code;
-(void)insert_item;
-(void)clear_item;


@end